home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / Apache 1.0 / src / README < prev    next >
Text File  |  1995-12-04  |  7KB  |  143 lines

  1. The basic idea of the new Apache release is to make a modular
  2. "tinkertoy" server, to which people can easily add code which is
  3. valuable to them (even if it isn't universally useful) without hairing
  4. up a monolithic server.  Applications for this idea include database
  5. integration, support for experimental search and scripting extensions,
  6. new authentication modes (digest authentication, for instance, could
  7. be done entirely as a module), and so forth.  All modules have the
  8. same interface to the server core, and through it, to each other.
  9.  
  10. In particular, the following are modules in the current code base:
  11. common log format (other loggers can easily coexist with it), auth and
  12. dbm auth (although both use common code in http_protocol.c to parse
  13. the Authorization: line), directory handling (which can be added or
  14. replaced), handling of aliases and access control, content
  15. negotiation, CGI, includes, aliases, and so forth.  (What's left in
  16. the basic server?  Not a whole lot).  The configuration file commands
  17. which configure these things are defined, for the most part, by the
  18. modules themselves, and not by the server core (each module has, or
  19. can have, a command dispatch table).
  20.  
  21. Besides carving up the base code into modules, this release makes a
  22. few other fairly pervasive changes.  Most of the global variables are
  23. gone; most of the MAX_STRING_LENGTH char arrays are gone (the few that
  24. are left being sprintf() targets, or I/O buffers of various sorts),
  25. and unmunge_name has vanished.  The most drastic change is the use of
  26. a "compool" strategy to manage resources allocated for a request ---
  27. the code in alloc.c keeps track of it all and allows it to be freed en
  28. bloc at the end of the request.  This strategy seems to be effective
  29. in stanching memory and descriptor leaks.
  30.  
  31. Additional third-party modules can be found at
  32. <URL:http://www.apache.org/dist/contrib/modules/>.
  33.  
  34.  
  35. A brief code review:
  36.  
  37. The code here can be divided into the server core (the http_* files,
  38. along with alloc.c and the various utility files), and several modules
  39. (the mod_* files).
  40.  
  41. The core interfaces to modules through the "module" structure which
  42. describes each one.  There's a linked list of these things rooted at
  43. top_module, through which http_config.c dispatches when necessary.  The
  44. module structures themselves are defined at the bottom of the mod_foo
  45. files.  (Loading new modules dynamically at runtime should be simple;
  46. just push them onto the linked list.  The only complication is what to
  47. do with AddModule commands when the config files are reread,
  48. particularly if you find a module has been taken out).
  49.  
  50. In addition to the core itself (which does have a module structure to
  51. hold its command tables, and the handlers for various phases of
  52. request handling which make it *barely* a web server on its own),
  53. the modules included here are the following:
  54.  
  55. mod_mime.c --- deduction of MIME types and content-encodings from
  56.   filename extensions.  This module defines the AddType, AddEncoding,
  57.   and TypesConfig config-file directives.  This code is off in a
  58.   module by itself so that people who want to experiment with other
  59.   meta-information schemes can replace it, and still have content
  60.   negotiation work.
  61.  
  62. mod_common_log.c --- logging in common log format.
  63.  
  64. mod_auth.c --- HTTP authentication.  Defines the AuthUserFile and
  65.   AuthGroupFile directives (other auth-related commands are handled by
  66.   the core itself, so it knows which requests require it to poll the
  67.   modules for authentication handlers).
  68.  
  69. mod_auth_dbm.c --- DBM auth.  Untested, and left out of the modules
  70.   list in modules.c because of that, but it does at least compile.
  71.   Grump. 
  72.  
  73. mod_access.c --- access checking by DNS name or IP address; defines
  74.   the "order", "allow" and "deny" config-file commands.  (If this
  75.   module is compiled out, the server fails safe --- any attempt to
  76.   configure access control will die on a config file syntax error when
  77.   the relevant commands go unrecognized).
  78.  
  79. mod_negotiation.c --- Content negotiation.  Defines the
  80.   CacheNegotiatedDocs config-file command.  Making this a module is
  81.   perhaps going overboard, but I wanted to see how far I could push
  82.   it. 
  83.  
  84. mod_alias.c --- Alias command and file translation.
  85.  
  86. mod_userdir.c --- ditto for Userdir.
  87.  
  88. mod_cgi.c --- Common Gateway Interface.  Also defines ScriptAlias,
  89.   because scripts are treated slightly differently depending on
  90.   whether they are ScriptAliased or not (in particular, ExecCGI is not
  91.   required in the former case).
  92.  
  93. mod_includes.c --- server-side includes.
  94.  
  95. mod_dir.c --- defines a whole *raft* of commands; handles directories.
  96.  
  97. mod_asis.c --- ASIS file handling.
  98.  
  99. mod_dld.c --- the experimental runtime-code-loader described above.
  100.   You'll have to alter the makefile and modules.c to make this active
  101.   if you want it.
  102.  
  103.  
  104.  
  105. As to the core, here's a brief review of what's where:
  106.  
  107. http_protocol.c --- functions for dealing directly with the client.
  108.   Reading requests, writing replies of various sorts.  I've tried to
  109.   route all data transfer between server and client through here, so
  110.   there's a single piece of code to change if we want to add, say,
  111.   HTTP-NG packetization.  The major glaring exception is NPH- CGI
  112.   scripts; what *will* we do with those for HTTP-NG?
  113.  
  114. http_request.c --- functions which direct the processing of requests,
  115.   including error handling.  Generally responsible for making sure
  116.   that the right module handlers get invoked, in the right order.
  117.   (This includes the "sub-request" mechanism, which is used by
  118.   includes and other stuff to ask about the status of particular
  119.   subfiles).
  120.  
  121. http_core.c --- 
  122.   Contains the core module structure, its command table, and the
  123.   command handlers, also the filename translation routine, and the
  124.   like for the core.  (Basically, this is all of the core module stuff
  125.   which looks more or less like the boilerplate from the other modules).
  126.  
  127. http_config.c --- Functions to read config files and dispatch to the
  128.   command handlers; also, routines to manage configuration vectors,
  129.   and to dispatch to modules' handlers for the various phases of
  130.   handling a request.  
  131.  
  132. http_log.c --- just the error log.  Error handling is split between
  133.   http_protocol.c (for generating the default error responses) and
  134.   http_request.c (for executive handling, including ErrorDocument
  135.   invocation); transaction logging is in the modules.
  136.  
  137. http_main.c --- System startup, restart, and accepting connections;
  138.   also timeout handling (which is pretty grotesque right now; ideas?)
  139.  
  140. alloc.c --- allocation of all resources which might have to be reclaimed
  141.   eventually, including memory, files, and child processes.
  142.  
  143.